Raspberry Pi /RP2350 /HSTX_CTRL /CSR

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text

Interpret as CSR

31 2827 2423 2019 1615 1211 87 43 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (EN)EN 0 (EXPAND_EN)EXPAND_EN 0 (COUPLED_MODE)COUPLED_MODE 0COUPLED_SEL 0SHIFT0N_SHIFTS0CLKPHASE 0CLKDIV

Fields

EN

When EN is 1, the HSTX will shift out data as it appears in the FIFO. As long as there is data, the HSTX shift register will shift once per clock cycle, and the frequency of popping from the FIFO is determined by the ratio of SHIFT and SHIFT_THRESH.

When EN is 0, the FIFO is not popped. The shift counter and clock generator are also reset to their initial state for as long as EN is low. Note the initial phase of the clock generator can be configured by the CLKPHASE field.

Once the HSTX is enabled again, and data is pushed to the FIFO, the generated clock’s first rising edge will be one half-period after the first data is launched.

EXPAND_EN

Enable the command expander. When 0, raw FIFO data is passed directly to the output shift register. When 1, the command expander can perform simple operations such as run length decoding on data between the FIFO and the shift register.

Do not change CXPD_EN whilst EN is set. It’s safe to set CXPD_EN simultaneously with setting EN.

COUPLED_MODE

Enable the PIO-to-HSTX 1:1 connection. The HSTX must be clocked directly from the system clock (not just from some other clock source of the same frequency) for this synchronous interface to function correctly.

When COUPLED_MODE is set, BITx_SEL_P and SEL_N indices 24 through 31 will select bits from the 8-bit PIO-to-HSTX path, rather than shifter bits. Indices of 0 through 23 will still index the shift register as normal.

The PIO outputs connected to the PIO-to-HSTX bus are those same outputs that would appear on the HSTX-capable pins if those pins’ FUNCSELs were set to PIO instead of HSTX.

For example, if HSTX is on GPIOs 12 through 19, then PIO outputs 12 through 19 are connected to the HSTX when coupled mode is engaged.

COUPLED_SEL

Select which PIO to use for coupled mode operation.

SHIFT

How many bits to right-rotate the shift register by each cycle.

The use of a rotate rather than a shift allows left shifts to be emulated, by subtracting the left-shift amount from 32. It also allows data to be repeated, when the product of SHIFT and N_SHIFTS is greater than 32.

N_SHIFTS

Number of times to shift the shift register before refilling it from the FIFO. (A count of how many times it has been shifted, not the total shift distance.)

A register value of 0 means shift 32 times.

CLKPHASE

Set the initial phase of the generated clock.

A CLKPHASE of 0 means the clock is initially low, and the first rising edge occurs after one half period of the generated clock (i.e. CLKDIV/2 cycles of clk_hstx). Incrementing CLKPHASE by 1 will advance the initial clock phase by one half clk_hstx period. For example, if CLKDIV=2 and CLKPHASE=1:

  • The clock will be initially low

  • The first rising edge will be 0.5 clk_hstx cycles after asserting first data

  • The first falling edge will be 1.5 clk_hstx cycles after asserting first data

This configuration would be suitable for serialising at a bit rate of clk_hstx with a centre-aligned DDR clock.

When the HSTX is halted by clearing CSR_EN, the clock generator will return to its initial phase as configured by the CLKPHASE field.

Note CLKPHASE must be strictly less than double the value of CLKDIV (one full period), else its operation is undefined.

CLKDIV

Clock period of the generated clock, measured in HSTX clock cycles. Can be odd or even. The generated clock advances only on cycles where the shift register shifts.

For example, a clkdiv of 5 would generate a complete output clock period for every 5 HSTX clocks (or every 10 half-clocks).

A CLKDIV value of 0 is mapped to a period of 16 HSTX clock cycles.

Links

() ()